//
// Created by andryu on 2025/1/1.
//
#ifndef LEARNTUTORIAL_SHAPERENDERER_H
#define LEARNTUTORIAL_SHAPERENDERER_H

#include <GLES3/gl3.h>
#include <string>
#include <vector>
#include <jni.h>

class ShapeRenderer{
public:
    virtual ~ShapeRenderer() = default;

    //纯虚函数，必须被子类实现
    virtual void onSurfaceCreated() = 0;
    virtual void onDrawFrame() = 0;

    virtual void onSurfaceChanged(jint width, jint height) = 0;

    // 虚函数用于获取顶点和片段着色器代码
    virtual std::string getVertexShaderCode() const = 0;
    virtual std::string getFragmentShaderCode() const = 0;

protected:
    GLuint mProgram;
    std::vector<GLfloat> mVertices;  // 使用 std::vector 存储顶点数据
};

#endif //LEARNTUTORIAL_SHAPERENDERER_H
